#include<stdio.h>
int main()
{
 char a,b,c,A,B,C;
 int sum;
 sum=0;
 printf("Please type in the first number or character:\n");
 scanf("%c%c",&a,&A);
 getchar();
 if(a == '1')
 sum = sum + 10;
if(a >= 50 && a <= 57)
sum = sum + a - 48;
 else 
 {
 if(a == 'J' || a == 'Q' || a == 'K')
sum = sum + 10;
 if(sum <= 10 && a == 'A')
 sum = sum + 11;
 }
 printf("Please type in the second number or character:\n");
 scanf("%c%c",&b,&B);
 getchar();
 if(b == '1')
 sum = sum + 10;
 if(b >= 50 && b <= 57)
 sum = sum + b - 48;
 else 
 {
 if(b == 'J' || b == 'Q' || b == 'K')
 sum = sum + 10;
 if(sum >= 11 && b == 'A')
 sum = sum + 1;
 if(sum <= 10 && b == 'A')
sum = sum + 11;
 }
 printf("Please type in the third number or character:\n");
 scanf("%c%c",&c,&C);
 getchar();
 if(c == '1')
 sum = sum + 10;

 
 if(c >= 50 && c <= 57)
 sum = sum + c - 48;
 else 
 {
 if(c == 'J' || c == 'Q' || c == 'K')
 sum = sum + 10;
 if(sum >= 11 && c == 'A')
 sum = sum + 1;
 if(sum <= 10 && c == 'A')
 sum = sum + 11;
 }
 if(sum>=22 && a == 'A')
 sum = sum - 10;
 if(sum>=22 && b == 'A')
sum = sum - 10;
  if(sum>=22 && c == 'A')
 sum = sum - 10;
printf("The sum is:%d\n",sum);
    return 0;
}

